package com.power.sifa.approve.dao;

import com.power.sifa.approve.model.Aprv_materials_customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 自定义过程材料 持久层(hibernate)
 */

public interface Aprv_materials_customerDao extends JpaRepository<Aprv_materials_customer, Serializable>, JpaSpecificationExecutor<Aprv_materials_customer>, Repository<Aprv_materials_customer, Serializable>, Aprv_materials_customerDaoCustom<Aprv_materials_customer, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from Aprv_materials_customer s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);


   @Query("select max(s.sortnum)  from Aprv_materials_customer s where  s.applyid = :applyid")
   Integer queryMaxSotNumrByApplyid(@Param("applyid") String applyid);

}
